<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<style>
		html,body{
			margin:0;
			padding:0;
			width: 100%;
			height: 100%;
			overflow: hidden;
		}
		#box{
			width:50px; height: 50px; background: blue;
			position: absolute; left: 100px; top: 150px;
			border-radius: 50%;
		}
	</style>
	<script type="text/javascript">
		
		//缓冲运动
		onload = function(){
			var box = document.getElementById("box");
			var wall = document.getElementById("wall");
			console.log(wall.offsetLeft);
			//给定一个起始的角度dargee
			var dargee = 0;
			var move = setInterval(function(){
				//给定一个起始速度
				var speedx = (wall.offsetLeft - box.offsetLeft)/10;
				speedx = speedx < 1 ? 1 : speedx;
				box.style.left = box.offsetLeft + speedx*Math.sin(dargee*Math.PI/180) + "px";
				if(box.offsetLeft >= (wall.offsetLeft - box.offsetWidth)){
					clearInterval(move);
				}
				dargee++;
			},30);
		}
	</script>
	<body>
		<div id="box">
			
		</div>
		<div id="wall" style="width: 1px; height: 100%; position: absolute; left:800px; top: 0; background: black;">
			
		</div>
	</body>
</html>
